package com.design.YiTong.shop.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.design.YiTong.model.medicinal.MedicinalShare;
import com.design.YiTong.shop.mapper.ShareMapper;
import com.design.YiTong.shop.service.ShareService;
import org.springframework.stereotype.Service;

@Service
public class ShareServiceImpl extends
        ServiceImpl<ShareMapper, MedicinalShare> implements ShareService {

    @Override
    public IPage<MedicinalShare> showShare(Page<MedicinalShare> pageParam) {
        QueryWrapper<MedicinalShare>wrapper=new QueryWrapper<>();
        wrapper.eq("is_deleted",0);
        IPage<MedicinalShare> pages = baseMapper.selectPage(pageParam,wrapper);
        return pages;
    }

    @Override
    public void saveShare(MedicinalShare medicinalShare) {
        baseMapper.insert(medicinalShare);
    }

    @Override
    public void removeShare(long id) {
        QueryWrapper<MedicinalShare>wrapper=new QueryWrapper<>();
        wrapper.eq("id",id);
        baseMapper.delete(wrapper);
    }


}
